﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace Domep.Server.BusinessObjects
{
    /*
     * Représentation d'un appareil connu du serveur
     */
    public class Appliance
    {
        public int Id { get; set; }
        public byte[] IpAddressParts { get; set; }
        public string MacAdress { get; set; }
        public string NameOnNetwork { get; set; }
        public int FirmwareNumber { get; set; }
        public int ProtocolId { get; set; }
        public string Reference { get; set; }
        public string SerialNumber { get; set; }
        public ApplianceModel Model { get; set; }

        //Constructeur pour le Dev. A supprimer une fois l'accès en base implémenté.
        public Appliance()
            : this(new byte[4]{1,1,1,1}, "00-11-22-33-44-55", "Four", new ApplianceModel("Four", "MarqueDuFour", ApplianceType.Oven, new List<Functionality>()), "ReferenceDuFour", "SerialNumberDuFour", 1, 1)
        {
        }

        public Appliance(byte[] ipAddressParts, string macAdress, string nameOnNetwork,
            ApplianceModel model, string reference, string serialNumber, int protocolId, int firmwareNumber)
        {
            IpAddressParts = new byte[4];
            for (int i = 0; i < 4; i++)
                IpAddressParts[i] = ipAddressParts[i];

            MacAdress = macAdress;
            NameOnNetwork = nameOnNetwork;
            FirmwareNumber = firmwareNumber;
            ProtocolId = protocolId;
            Reference = reference;
            SerialNumber = serialNumber;
            Model = model;
        }
    }
}
